#!/usr/bin/env bash

# ----------------------------------------------------------------------
# Filename	:  messages_test
# Version	:  1.0
# Date		:  2023/12/21
# Author	:  yaoxiyao
# Email		:  yaoxiyao@kylinos.com.cn 
# History	:     
#              Version 1.0, 2023/12/21
# Function	:  支持messages日志查看
# Out		:        
#              0 => TPASS
#              1 => TFAIL
#              other=> TCONF
# ----------------------------------------------------------------------

# 测试主题
Title_Env_LTFLIB="支持messages日志查看"

KEYWORD_LTF_LOG="FAIL|fail|error|ERROR"

## TODO : 个性化,初始化
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestInit_LTFLIB(){
    return $TPASS
}


## TODO : 清理函数
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestClean_LTFLIB(){	
    return $TPASS
}


## TODO : 测试用例集
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
Testsuite_LTFLIB(){
    testcase_1
    return $TPASS
}


## TODO ： 支持messages日志查看
testcase_1(){
    cp /var/log/messages ${LOG_PATH}
    CommRetParse_LTFLIB "messages日志已保存在${LOG_PATH}"

    cat /var/log/messages |grep -E "${KEYWORD_LTF_LOG}"
    CommRetParse_LTFLIB "cat /var/log/messages |grep -E ${KEYWORD_LTF_LOG}" "False" "yes"
}


#----------------------------------------------#

source "${LIB_LTFLIB}"
Main_LTFLIB $@
